package com.yuanxing.oushangyidali.dialog

import android.os.Bundle
import android.view.Window
import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import com.fhx.core.base.BaseDialogFragment
import com.yuanxing.oushangyidali.R

/**
 * @auther : hhx
 * @date   :  2021/3/17
 * @des    :修改价格
 */
 class AmendDialog(listener: CallbackListener) : BaseDialogFragment() {
    private var ivClose: ImageView? = null
    private var edit_num: EditText? = null
    private var tv_commit_invite: TextView? = null
    private var listener:CallbackListener?=null
    init {
        this.listener=listener
    }
    override fun getLayoutId(): Int = R.layout.dialog_amend

    override fun getDialogStyle(): Int {
        return R.style.fullScreenDialog
    }

    override fun initView(arguments: Bundle?) {
        ivClose = findViewById(R.id.iv_close_invite) as ImageView?
        edit_num = findViewById(R.id.edit_num) as EditText?
        tv_commit_invite = findViewById(R.id.tv_commit_invite) as TextView?
        ivClose?.setOnClickListener {
            dismissAllowingStateLoss()
        }
        tv_commit_invite?.setOnClickListener {
            val inviteCode=edit_num?.text.toString().trim()
                if (listener!=null&&inviteCode!=null){
                    listener?.callBack(inviteCode)
                }
                dismissAllowingStateLoss()
        }
    }

    override fun canCancel(): Boolean {
     return true
    }

    override fun setWindowAttributes(window: Window?) {

    }
    interface CallbackListener{
        fun callBack(inviteId: String)
    }




}